package com.aconcagua.factory {
  import com.aconcagua.beans.BeanDefinition;
  import com.aconcagua.beans.BeanDefinitionFactory;

  public class Alias implements BeanDefinitionFactory {
    private var _name: String;
    public var ref: BeanDefinition;
    
    public function set name(aName: String): void {
      _name = aName;
    }

    public function get name():String {
      return _name;
    }

    public function registerIn(beanFactory:BeanFactory):void {
      beanFactory.registerAlias(_name, ref);
    }

    public function isRegisteredIn(beanFactory: BeanFactory): Boolean {
      return beanFactory.containsBean(_name);
    }
    
    public function retrieveFrom(beanFactory: BeanFactory): Object {
      return beanFactory.getBean(_name);
    }
    
  }
}